#!/bin/sh

PRJ_SRC=sakcab
PRJ_DST=fekcab

[ -d $PRJ_SRC ] || ( echo "no $PRJ_SRC" && exit 1 )
[ -d $PRJ_DST ] || mkdir $PRJ_DST

# clone directory structure
cd $PRJ_SRC
SRC_DIRS=`find . -type d | grep -v '.svn'`
cd -

for DIR in $SRC_DIRS
do
	DST_DIR=$PRJ_DST/$DIR
	[ -d $DST_DIR ] || mkdir -p $DST_DIR
done

# clone files
cd $PRJ_SRC
SRC_FILES=`find . -type f | grep -v '.svn'`
cd -

for FILE in $SRC_FILES
do
	SRC_FILE=$PRJ_SRC/$FILE
	DST_FILE=$PRJ_DST/$FILE
	cat $SRC_FILE | sed -e 's/SAKCAB/FEKCAB/g' -e 's/sakcab/fekcab/g' >$DST_FILE
done

